

class Student1{
    String name;
    public int age;
    public static int high;

    public Student1() {
        System.out.println("构造方法");
    }

    {
        this.name="lisi";
        this.age=10;
        System.out.println("构造代码块");
    }
    static {
        high=100;
        System.out.println("静态代码块");
    }
    public void show()
    {
        System.out.println("name:"+name+" "+"age:"+age+"high:"+high);
        {
            System.out.println("普通代码块");
        }

    }
}
public class Test5 {
    public static void main(String[] args) {
        Student1 student1=new Student1();
        student1.show();
        System.out.println("=======");
        Student1 student2=new Student1();
        student2.show();

    }
}

//class student{
//    String name;
//    public int age;
//
//    public student(String name, int age) {
//        this.name = name;
//        this.age = age;
//    }
//
//    public String getName() {
//        return name;
//    }
//
//    public void setName(String name) {
//        this.name = name;
//    }
//
//    public void show()
//    {
//        System.out.println("name:"+name+" "+"age:"+age);
//    }
//}
//public class Test5 {
//    public static void main(String[] args) {
//        student student=new student("zhangsan",20);
//        student.setName("lisi");
//        student.getName();
//        student.age=21;
//
//    }
//}
